package com.wyzz.hr.report.action;

import java.util.Calendar;
import java.util.List;

import com.wyzz.hr.base.BaseAction;
import com.wyzz.hr.bo.IDepartmentBO;
import com.wyzz.hr.bo.IEmpsalarydatadefBo;
import com.wyzz.hr.bo.IEmpsalaryperiodBo;
import com.wyzz.hr.bo.ISalaryPaidBo;
import com.wyzz.hr.pojo.Jobgrade;
import com.wyzz.hr.spring.SpringBeanFactory;

public class SalaryReportInit extends BaseAction {

	public SalaryReportInit() {
	}

	public String execute() throws Exception {
		IEmpsalarydatadefBo defBo = (IEmpsalarydatadefBo) getBean("empsalarydatadefBo");
		items = defBo.searchAll();
		IEmpsalaryperiodBo salaryperiod = (IEmpsalaryperiodBo) getBean("empsalaryperiodBO");
		years = salaryperiod.getAllYears();
		ISalaryPaidBo salaryPaidBo = (ISalaryPaidBo) getBean("salaryPaidBo");
		IDepartmentBO deptbo = (IDepartmentBO) SpringBeanFactory
				.getBean("departmentBO");
		departments = deptbo.FindEnabledDepartment();
		jobgrades = salaryPaidBo.getObjects(Jobgrade.class, null);
		Calendar now = Calendar.getInstance();
		year = String.valueOf(now.get(1));
		int tmpMonth = now.get(2) + 1;
		month = String.valueOf(tmpMonth <= 9 ? ((Object) ((new StringBuilder())
				.append("0").append(tmpMonth).toString())) : ((Object) (Integer
				.valueOf(tmpMonth))));
		return "success";
	}

	public List getItems() {
		return items;
	}

	public void setItems(List items) {
		this.items = items;
	}

	public List getDepartments() {
		return departments;
	}

	public void setDepartments(List departments) {
		this.departments = departments;
	}

	public List getYears() {
		return years;
	}

	public void setYears(List years) {
		this.years = years;
	}

	public List getJobgrades() {
		return jobgrades;
	}

	public void setJobgrades(List jobgrades) {
		this.jobgrades = jobgrades;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	private List items;
	private List departments;
	private List years;
	private List jobgrades;
	private String year;
	private String month;
}
